<?php //ver.2011 0.1 - Eugenio Ghiglia <eugenio@blux.org> - 

function _login($email,$password) {
    global $db;
    $user=false;
    $password=md5($password);
    $sql="SELECT id_utente FROM tbl_utenti
          WHERE email='".addslashes($email)."'
            AND password='$password'
            AND abilitato='1'
          LIMIT 1";
    $db->sql_arr($sql, $record, $n);      
    if ($n) {
        $user=$record[0]['id_utente'];
        $db->sql("UPDATE tbl_utenti SET data_ultimoaccesso=NOW() WHERE id_utente='$user'");
    }
    return $user;
}

?>
